﻿using System;
using System.Collections.Generic;
using System.Text;

namespace X3DLib
{
    public class Background:X3DObject
    {
        private string SkyAngle;
        public string skyAngle
        {
            get { return SkyAngle; }
            set { SkyAngle = value; }
        }

        private string SkyColor;
        public string skyColor
        {
            get { return SkyColor; }
            set { SkyColor = value; }
        }

        private string GroundAngle;
        public string groundAngle
        {
            get { return GroundAngle; }
            set { GroundAngle = value; }
        }

        private string GroundColor;
        public string groundColor
        {
            get { return GroundColor; }
            set { GroundColor = value; }
        }

        private string LeftUrl;
        public string leftUrl
        {
            get { return LeftUrl; }
            set { LeftUrl = value; }
        }

        private string RightUrl;
        public string rightUrl
        {
            get { return RightUrl; }
            set { RightUrl = value; }
        }

        private string FrontUrl;
        public string frontUrl
        {
            get { return FrontUrl; }
            set { FrontUrl = value; }
        }

        private string BackUrl;
        public string backUrl
        {
            get { return BackUrl; }
            set { BackUrl = value; }
        }

        private string TopUrl;
        public string topUrl
        {
            get { return TopUrl; }
            set { TopUrl = value; }
        }

        private string BottomUrl;
        public string bottomUrl
        {
            get { return BottomUrl; }
            set { BottomUrl = value; }
        }

        private string BindTime;
        public string bindTime
        {
            get { return BindTime; }
            set { BindTime = value; }
        }

        private string Set_bind;
        public string set_bind
        {
            get { return Set_bind; }
            set { Set_bind = value; }
        }

        private string IsBound;
        public string isBound
        {
            get { return IsBound; }
            set { IsBound = value; }
        }

        public Background()
        {
            this.SkyColor = "0.239216 0.839216 1";
        }

        /// <summary>
        /// 获取背景属性
        /// </summary>
        /// <returns></returns>
        public override string getAttrs()
        {
            return "skyAngle|" + this.skyAngle + "|float,"
                    + "skyColor|" + this.skyColor + "|max:2 min:1,"
                    + "groundAngle|" + this.groundAngle.ToString() + "|float"
                    + "groundColor|" + this.groundColor + "|max:2 min:1,"
                    + "leftUrl|" + this.leftUrl + "|string,"
                    + "rightUrl|" + this.rightUrl + "|string,"
                    + "frontUrl|" + this.frontUrl + "|string,"
                    + "backUrl|" + this.backUrl + "|string,"
                    + "topUrl|" + this.topUrl + "|string,"
                    + "bottomUrl|" + this.bottomUrl + "|string";
        }

        /// <summary>
        /// 设置背景属性
        /// </summary>
        /// <param name="attrs"></param>
        public override void setAttrs(string attrs)
        {
            string[][] temp = X3DString.getArrayByAttrs(attrs);
            for (int i = 0; i < temp.Length; i++)
            {
                switch (temp[i][0])
                {
                    case "skyAngle":
                        this.skyAngle = temp[i][1];
                        break;
                    case "skyColor":
                        this.skyColor = temp[i][1];
                        break;
                    case "groundAngle":
                        this.groundAngle = temp[i][1];
                        break;
                    case "groundColor":
                        this.groundColor = temp[i][1];
                        break;
                    case "leftUrl":
                        this.leftUrl = temp[i][1];
                        break;
                    case "rightUrl":
                        this.rightUrl = temp[i][1];
                        break;
                    case "frontUrl":
                        this.frontUrl = temp[i][1];
                        break;
                    case "backUrl":
                        this.backUrl = temp[i][1];
                        break;
                    case "topUrl":
                        this.topUrl = temp[i][1];
                        break;
                    case "bottomUrl":
                        this.bottomUrl = temp[i][1];
                        break;
                }
            }
        }
    }
}
